<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        function isCycleObj(obj, parent) {
            const parentArr = parent || [obj]
            for (let i in obj) {
                if (typeof obj[i] == 'object') {
                    let flag = false
                    parentArr.forEach(element => {
                        if (element == obj[i]) {
                            flag = true
                        }

                    });
                    if (flag) return true
                    flag = isCycleObj(obj[i], [...parentArr, obj[i]])
                    if (flag) return true
                }
            }
            return false


        }
    </script>
</body>

</html>